<?php

namespace App\Transformers\User;

use App\Models\UserSearch;
use League\Fractal\TransformerAbstract;

class UserSearchesTransformer extends TransformerAbstract
{
    public function transform(UserSearch $userSearch)
    {
        return [
            'id' => $userSearch->id,
            'user_id'=>$userSearch->user_id ?? '',
            'keyword'=>$userSearch->keyword ?? '',
            'vicword'=>$userSearch->vicword ?? '',
            'num'=>$userSearch->num ?? '',
            'result'=>$userSearch->result ?? '',
            'delete_at'=>$userSearch->delete_at ?? '',
            'created_at' => $userSearch->created_at ? $userSearch->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $userSearch->updated_at ? $userSearch->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
